(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/cloneDeep'), require('@/utils/lang'), require('@/utils/validator'), require('yly-form-source/lib/yly-form-constants'), require('@/utils'), require('ejs'), require('@/mixins/VxeGridMixin'), require('@/utils/util')) :
  typeof define === 'function' && define.amd ? define(['exports', 'lodash/cloneDeep', '@/utils/lang', '@/utils/validator', 'yly-form-source/lib/yly-form-constants', '@/utils', 'ejs', '@/mixins/VxeGridMixin', '@/utils/util'], factory) :
  (global = global || self, factory(global['yly-form-controller'] = {}, global.cloneDeep, global.lang, global.validator, global.ylyFormConstants, global.utils, global.ejs, global.VxeGridMixin, global.util));
}(this, (function (exports, cloneDeep, lang, validator, ylyFormConstants, utils, ejs, VxeGridMixin, util) { 'use strict';

  cloneDeep = cloneDeep && Object.prototype.hasOwnProperty.call(cloneDeep, 'default') ? cloneDeep['default'] : cloneDeep;
  ejs = ejs && Object.prototype.hasOwnProperty.call(ejs, 'default') ? ejs['default'] : ejs;

  function _defineProperty(e, r, t) {
    return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
      value: t,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[r] = t, e;
  }
  function _toPrimitive(t, r) {
    if ("object" != typeof t || !t) return t;
    var e = t[Symbol.toPrimitive];
    if (void 0 !== e) {
      var i = e.call(t, r || "default");
      if ("object" != typeof i) return i;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return ("string" === r ? String : Number)(t);
  }
  function _toPropertyKey(t) {
    var i = _toPrimitive(t, "string");
    return "symbol" == typeof i ? i : i + "";
  }

  var FormInputConfig = {
    version: 'v2.0',
    code: 'FORM_INPUT',
    type: 'input',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormTextInput',
      edit: 'FormTextInput',
      read: 'FormTextInput'
    },
    desc: {
      icon: 'icon-write',
      type: 'input'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('输入框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%',
      // 宽度
      placeholder: '请输入',
      // 没有输入时，提示文字
      clearable: false,
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      afterSaveResetStatus: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      maxLength: null,
      promptMessageContent: '',
      isCc: false // 是否抄送字段
    },
    default: {
      defaultValue: '',
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'INPUT_TYPE', 'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'INPUT_TYPE', 'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    methods: {}
  };

  var FormTextareaConfig = {
    version: 'v2.0',
    code: 'FORM_TEXTAREA',
    type: 'textarea',
    // 原来的表单类型
    key: '',
    renderComponent: {
      ide: 'FormTextareaInput',
      edit: 'FormTextareaInput',
      read: 'FormTextareaInput'
    },
    desc: {
      icon: 'icon-edit',
      type: 'textarea'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('文本框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-edit',
      width: '100%',
      // 宽度
      minRows: 4,
      maxRows: 6,
      placeholder: '请输入',
      // 没有输入时，提示文字
      clearable: false,
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      afterSaveResetStatus: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      maxLength: 2000,
      promptMessageContent: '',
      isCc: false // 是否抄送字段
    },
    default: {
      defaultValue: '',
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'TEXTAREA_HEIGHT', 'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'TEXTAREA_HEIGHT', 'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    }
  };

  var FormNumberInputConfig = {
    version: 'v2.0',
    code: 'FORM_NUMBER_INPUT',
    type: 'number',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormNumberInput',
      edit: 'FormNumberInput',
      read: 'FormNumberInput'
    },
    desc: {
      icon: 'icon-number',
      type: 'number'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('数字输入框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-number',
      // OPTIONS 属性
      width: '100%',
      // 宽度
      minValue: null,
      // 可输入最小值
      maxValue: null,
      // 可输入最大值
      precision: null,
      step: 1,
      // 步长，点击加减按钮时候，加减多少
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用
      placeholder: lang.lang('请输入'),
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'STEP_SIZE', 'NUMBER_MIN', 'NUMBER_MAX', 'NUMBER_PRECISION', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'PLACEHOLDER',
      // 'COMPONENT_WIDTH',
      'NUMBER_MIN', 'NUMBER_MAX',
      // 'NUMBER_PRECISION',
      'COMPONENT_DEFAULT_VALUE',
      // 'COMPONENT_SAVE_RESET',
      'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE'
      // 'CUSTOM_EVENT'
      ]
    }
  };

  var FormSelectInputConfig = {
    version: 'v2.0',
    code: 'FORM_SELECT_INPUT',
    type: 'select',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormSelectInput',
      edit: 'FormSelectInput',
      read: 'FormSelectInput'
    },
    desc: {
      icon: 'icon-xiala',
      type: 'select'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('下拉选择器'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-xiala',
      // OPTIONS 属性
      width: '100%',
      // 宽度
      multiple: false,
      // 是否允许多选
      disabled: false,
      // 是否禁用
      clearable: false,
      // 是否显示清除按钮
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      placeholder: lang.lang('请选择'),
      // 默认提示文字
      dynamic: 'static',
      // 选项配置类型
      dynamicKey: '',
      // 数据字典code
      options: [
      // 静态数据
      // 下拉选择项配置
      {
        value: '1',
        label: lang.lang('下拉框1')
      }, {
        value: '2',
        label: lang.lang('下拉框2')
      }],
      distal: {
        // 远端数据配置
        dictType: 'static',
        dictCode: undefined,
        dictCondition: undefined,
        dictTable: undefined,
        dictField: undefined,
        dictText: undefined
      },
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      showSearch: false,
      // 是否显示搜索框，搜索选择的项的值，而不是文字
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      // 下拉选框请使用undefined为默认值
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'IS_USER_ATTR', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'PLACEHOLDER',
      // 'COMPONENT_WIDTH',
      'SELECT_OPTIONS_CONFIG', 'IS_USER_ATTR',
      // 'COMPONENT_SAVE_RESET',
      // 'PROMPT_MESSAGE',
      'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    }
  };

  var FormCheckBoxConfig = {
    version: 'v2.0',
    code: 'FORM_CHECK_BOX',
    type: 'checkbox',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormCheckBox',
      edit: 'FormCheckBox',
      read: 'FormCheckBox'
    },
    desc: {
      icon: 'icon-duoxuan1',
      type: 'select'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('多选框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-duoxuan1',
      // OPTIONS 属性
      disabled: false,
      // 是否禁用
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      dynamicKey: '',
      dynamic: 'static',
      options: [{
        value: '1',
        label: lang.lang('选项1')
      }, {
        value: '2',
        label: lang.lang('选项2')
      }, {
        value: '3',
        label: lang.lang('选项3')
      }],
      distal: {
        // 远端数据配置
        dictType: 'static',
        dictCode: undefined,
        // 字典code
        dictCondition: undefined,
        // 过滤信息
        dictTable: undefined,
        // 表字段名称
        tableId: undefined,
        // 表id
        dictField: undefined,
        // 列字段名称
        columnId: undefined,
        // 列id
        dictText: undefined //
      },
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: [],
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      // 'PLACEHOLDER',
      'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG',
      // 'COMPONENT_SAVE_RESET',
      // 'PROMPT_MESSAGE',
      'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE'
      // 'CUSTOM_EVENT'
      ]
    }
  };

  var FormRadioBoxConfig = {
    version: 'v2.0',
    code: 'FORM_RADIO_BOX',
    type: 'radio',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormRadioBox',
      edit: 'FormRadioBox',
      read: 'FormRadioBox'
    },
    desc: {
      icon: 'icon-danxuan-cuxiantiao'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('单选框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-danxuan-cuxiantiao',
      // OPTIONS 属性
      disabled: false,
      // 是否禁用
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      dynamicKey: '',
      dynamic: 'static',
      options: [{
        value: '1',
        label: lang.lang('选项1')
      }, {
        value: '2',
        label: lang.lang('选项2')
      }, {
        value: '3',
        label: lang.lang('选项3')
      }],
      distal: {
        // 远端数据配置
        dictType: 'static',
        dictCode: undefined,
        dictCondition: undefined,
        dictTable: undefined,
        dictField: undefined,
        dictText: undefined
      },
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      // 下拉选框请使用undefined为默认值
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormDateSelectConfig = {
    version: 'v2.0',
    code: 'FORM_DATE_SELECT',
    type: 'date',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormDateSelect',
      edit: 'FormDateSelect',
      read: 'FormDateSelect'
    },
    desc: {
      icon: 'icon-danxuan-cuxiantiao'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('日期选择框'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-danxuan-cuxiantiao',
      // OPTIONS 属性
      width: '100%',
      // 宽度
      range: false,
      // 范围日期选择，为true则会显示两个时间选择框（同时defaultValue和placeholder要改成数组），
      showTime: false,
      // 是否显示时间选择器
      disabled: false,
      // 是否禁用
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      clearable: false,
      // 是否显示清除按钮
      placeholder: lang.lang('请选择'),
      rangePlaceholder: [lang.lang('开始时间'), lang.lang('结束时间')],
      format: 'YYYY-MM-DD',
      // 展示格式  （请按照这个规则写 YYYY-MM-DD HH:mm:ss，区分大小写）
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: '',
      // 默认值，字符串 12:00:00
      rangeDefaultValue: [],
      // 默认值，字符串 12:00:00
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'DATE_FORMAT', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'DATE_FORMAT', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormSwitchInputConfig = {
    version: 'v2.0',
    code: 'FORM_SWITCH_INPUT',
    type: 'switch',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormSwitchInput',
      edit: 'FormSwitchInput',
      read: 'FormSwitchInput'
    },
    desc: {
      icon: 'icon-kaiguan3',
      type: 'switch'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('开关'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-kaiguan3',
      // OPTIONS 属性
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: false,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'CUSTOM_EVENT'
      // 'COMPONENT_RULE'
      ]
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'CUSTOM_EVENT'
      // 'COMPONENT_RULE'
      ]
    }
  };

  var FormButtonConfig = {
    version: 'v2.0',
    code: 'FORM_BUTTON',
    type: 'button',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormButton',
      edit: 'FormButton',
      read: 'FormButton'
    },
    desc: {
      icon: 'icon-button-remove',
      type: 'button'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('按钮'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-button-remove',
      // OPTIONS 属性
      type: 'primary',
      handle: 'submit',
      dynamicFun: '',
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false // 是否禁用，false不禁用，true禁用
    },
    default: {
      defaultValue: false,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      // tableConfig: [
      //   'TableInfoEditor'
      // ],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR'
      // 'COMPONENT_RULE'
      ]
    },
    mobileEditor: {
      elementConfig: ['LABEL_INFO',
      //label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR']
    }
  };

  var FormStaticTextConfig = {
    version: 'v2.0',
    code: 'FORM_STATIC_TEXT',
    type: 'static-text',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormStaticText',
      edit: 'FormStaticText',
      read: 'FormStaticText'
    },
    desc: {
      icon: 'icon-zihao',
      type: 'static-text'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('文字'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-zihao',
      // OPTIONS 属性
      textAlign: 'left',
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      showRequiredMark: false,
      paddingLeft: '0%',
      promptMessageContent: '',
      countStatistics: {
        status: false,
        countNum: 0
      }
    },
    default: {
      defaultValue: 0,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      elementConfig: ['LABEL_INFO',
      //label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'TEXT_ALIGN', 'COUNT_STATISTICS', 'TEXT_PADDING_LEFT', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['LABEL_INFO',
      //label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'TEXT_ALIGN', 'COUNT_STATISTICS', 'TEXT_PADDING_LEFT', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormPhoneInputConfig = {
    version: 'v2.0',
    code: 'FORM_PHONE_INPUT',
    type: 'KPhoneInput',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormPhoneInput',
      edit: 'FormPhoneInput',
      read: 'FormPhoneInput'
    },
    desc: {
      icon: 'icon-write'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('电话号码'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: "100%",
      // 宽度
      defaultValue: "",
      // 默认值
      placeholder: lang.lang('电话号码'),
      // 没有输入时，提示文字
      clearable: false,
      isCc: false,
      maxLength: null,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: '',
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH',
      // 'COMPONENT_DEFAULT_VALUE',
      'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE',
      // 'INPUT_OPTIONS_ATTR',
      'COMPONENT_RULE', 'CUSTOM_EVENT']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      // label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH',
      // 'COMPONENT_DEFAULT_VALUE',
      'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE',
      // 'INPUT_OPTIONS_ATTR',
      'COMPONENT_RULE', 'CUSTOM_EVENT']
    }
  };

  var FormCascadeSelectConfig = {
    version: 'v2.0',
    code: 'FORM_CASCADE_SELECT',
    type: 'cascader',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormCascadeSelect',
      edit: 'FormCascadeSelect',
      read: 'FormCascadeSelect'
    },
    desc: {
      icon: 'icon-guanlian'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('级联选择器'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-guanlian',
      disabled: false,
      // 是否禁用
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      showSearch: false,
      // 是否显示搜索框，搜索选择的项的值，而不是文字
      placeholder: '请选择',
      clearable: false,
      // 是否显示清除按钮
      dynamicKey: '',
      dynamic: 'static',
      options: [{
        value: '1',
        label: lang.lang('选项1'),
        children: [{
          value: '11',
          label: lang.lang('选项11')
        }]
      }, {
        value: '2',
        label: '选项2',
        children: [{
          value: '22',
          label: lang.lang('选项22')
        }]
      }],
      distal: {
        // 远端数据配置
        dictType: 'static',
        dictCode: undefined,
        dictCondition: undefined,
        dictTable: undefined,
        dictField: undefined,
        dictText: undefined
      },
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormTreeSelectConfig = {
    version: 'v2.0',
    code: 'FORM_TREE_SELECT',
    type: 'treeSelect',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormTreeSelect',
      edit: 'FormTreeSelect',
      read: 'FormTreeSelect'
    },
    desc: {
      icon: 'icon-tree'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('树选择器'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-tree',
      disabled: false,
      // 是否禁用
      defaultValue: undefined,
      // 默认值
      multiple: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      clearable: false,
      // 是否显示清除按钮
      showSearch: false,
      // 是否显示搜索框，搜索选择的项的值，而不是文字
      treeCheckable: false,
      placeholder: lang.lang('请选择'),
      dynamicKey: '',
      dynamic: 'static',
      options: [{
        value: '1',
        label: lang.lang('选项1'),
        children: [{
          value: '11',
          label: lang.lang('选项11')
        }]
      }, {
        value: '2',
        label: lang.lang('选项2'),
        children: [{
          value: '22',
          label: lang.lang('选项22')
        }]
      }],
      distal: {
        // 远端数据配置
        dictType: 'static',
        dictCode: undefined,
        dictCondition: undefined,
        dictTable: undefined,
        dictField: undefined,
        dictText: undefined
      },
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'SELECT_OPTIONS_CONFIG', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormAreaSelectConfig = {
    version: 'v2.0',
    code: 'FORM_AREA_SELECT',
    type: 'KDistpickerSelect',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'KDistpickerSelect',
      edit: 'KDistpickerSelect',
      read: 'KDistpickerSelect'
    },
    desc: {
      icon: 'icon-tree'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('地区地址'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-tree',
      width: "100%",
      // 宽度
      defaultValue: {
        province: '',
        city: '',
        area: ''
      },
      // 默认值
      placeholder: lang.lang('地区地址'),
      // 没有输入时，提示文字
      clearable: false,
      isCc: false,
      maxLength: null,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    bindDataInfo: {
      provinceKey: undefined,
      // 省key
      provinceName: undefined,
      // 省名称
      provinceId: undefined,
      cityKey: undefined,
      // 市key
      cityName: undefined,
      // 市名称
      cityId: undefined,
      areaKey: undefined,
      // 区key
      areaName: undefined,
      // 区名称
      areaId: undefined
    },
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      type: 'object',
      validator: validator.AreaAddressValidator
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormDividerBoxConfig = {
    version: 'v2.0',
    code: 'FORM_DIVIDER_BOX',
    type: 'divider',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormDividerBox',
      edit: 'FormDividerBox',
      read: 'FormDividerBox'
    },
    desc: {
      icon: 'icon-fengexian'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('分割线'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-fengexian',
      orientation: 'left'
    },
    editor: {
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PROMPT_MESSAGE', 'ORIENTATION']
    },
    mobileEditor: {
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PROMPT_MESSAGE', 'ORIENTATION']
    }
  };

  var FormCardConfig = {
    version: 'v2.0',
    code: 'FORM_CARD',
    type: 'card',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormCard',
      edit: 'FormCard',
      read: 'FormCard'
    },
    desc: {
      icon: 'icon-qiapian'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('卡片布局'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-fengexian',
      orientation: 'left'
    },
    list: [],
    children: [],
    default: {},
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      // 'PROMPT_MESSAGE',
      // 'COMPONENT_RULE'
      ]
    },
    mobileEditor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    }
  };

  var FormGridConfig = {
    version: 'v2.0',
    code: 'FORM_GRID',
    type: 'grid',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormGrid',
      edit: 'FormGrid',
      read: 'FormGrid'
    },
    desc: {
      icon: 'icon-zhage'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('栅格布局'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-zhage',
      gutter: 0
    },
    colNum: 2,
    columns: [{
      span: 12,
      list: []
    }, {
      span: 12,
      list: []
    }],
    default: {},
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['GRID_GUTTER',
      //label 标签
      'GRID_COLUMN']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'GRID_GUTTER',
      //label 标签
      'GRID_COLUMN']
    }
  };

  var FormMyFieldConfig = {
    version: 'v2.0',
    code: 'FORM_MY_FIELD',
    type: 'myField',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormMyField',
      edit: 'FormMyField',
      read: 'FormMyField'
    },
    desc: {
      icon: 'icon-qiapian'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('字段集'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-qiapian',
      gutter: 0
    },
    list: [],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: [
        // 'SYSTEM_DEFAULT_VALUE'
      ]
    },
    mobileEditor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: [
        // 'SYSTEM_DEFAULT_VALUE'
      ]
    }
  };

  var FormUserSelectConfig = {
    version: 'v2.0',
    code: 'FORM_USER_SELECT',
    type: 'YLYUserSearch',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'YlYUserSearch',
      edit: 'YlYUserSearch',
      read: 'YlYUserSearch'
    },
    desc: {
      icon: 'icon-tree'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('人员查询'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-tree',
      width: '100%',
      // 宽度
      placeholder: lang.lang('请输入'),
      // 没有输入时，提示文字
      clearable: false,
      isCc: false,
      maxLength: null,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: ''
    },
    initQueryUrl: '',
    queryUrl: '/onlcode/saas/user/autoCompleteUserInfo',
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'IS_USER_ATTR', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'IS_USER_ATTR', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'COMPONENT_RULE']
    }
  };

  var FormOrgSelectConfig = {
    version: 'v2.0',
    code: 'FORM_ORG_SELECT',
    type: 'YLYOrgSearch',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'YLYOrgSearch',
      edit: 'YLYOrgSearch',
      read: 'YLYOrgSearch'
    },
    desc: {
      icon: 'icon-folder'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('组织查询'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-folder',
      width: '100%',
      // 宽度
      placeholder: lang.lang('请输入'),
      // 没有输入时，提示文字
      clearable: false,
      isCc: false,
      maxLength: null,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: ''
    },
    initQueryUrl: '',
    queryUrl: '/onlcode/saas/org/autoCompleteOrgInfo',
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'COMPONENT_RULE']
    }
  };

  var FormDocumentNumberConfig = {
    version: 'v2.0',
    code: 'FORM_DOCUMENT_NUMBER',
    type: 'FORM_DOCUMENT_NUMBER',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormDocumentNumber',
      edit: 'FormDocumentNumber',
      read: 'FormDocumentNumber'
    },
    desc: {
      icon: 'icon-folder'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('单据号'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-folder',
      width: '100%',
      // 宽度
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      disabled: false // 是否禁用，false不禁用，true禁用
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'INPUT_TYPE', 'PLACEHOLDER', 'COMPONENT_WIDTH', 'COMPONENT_DEFAULT_VALUE', 'COMPONENT_SAVE_RESET', 'PROMPT_MESSAGE', 'INPUT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'LABEL_INFO',
      //label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'COMPONENT_RULE']
    }
  };

  var FormAlertBoxConfig = {
    version: 'v2.0',
    code: 'FORM_ALERT_BOX',
    type: 'alert',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormAlertBox',
      edit: 'FormAlertBox',
      read: 'FormAlertBox'
    },
    desc: {
      icon: 'icon-zu',
      type: 'alert'
    },
    // TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('警告提示'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-zu',
      // OPTIONS 属性
      type: 'success',
      description: '',
      showIcon: false,
      banner: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      closable: false,
      promptMessageContent: ''
    },
    default: {
      defaultValue: 0,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      // label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'ALERT_TYPE', 'ALERT_OPTIONS_ATTR', 'COMPONENT_RULE']
    },
    mobileEditor: {
      elementConfig: ['LABEL_INFO',
      // label 标签
      'COMPONENT_WIDTH', 'PROMPT_MESSAGE', 'ALERT_TYPE', 'ALERT_OPTIONS_ATTR', 'COMPONENT_RULE']
    }
  };

  var FormTextFieldConfig = {
    version: 'v2.0',
    code: 'FORM_TEXT_FIELD',
    type: 'textField',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormTextField',
      edit: 'FormTextField',
      read: 'FormTextField'
    },
    desc: {
      icon: 'icon-zihao'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('文字'),
      textAlign: 'left',
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      showRequiredMark: false,
      promptMessageContent: ''
    },
    initQueryUrl: '',
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['SYSTEM_DEFAULT_VALUE']
    },
    mobileEditor: {
      elementConfig: ['TableInfoEditor', 'SYSTEM_DEFAULT_VALUE']
    }
  };

  var FormTableConfig = {
    version: 'v2.0',
    code: 'FORM_TABLE',
    type: 'formTable',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'FormTable',
      edit: 'FormTable',
      read: 'FormTable'
    },
    desc: {
      icon: 'icon-tree'
    },
    //TODO: 后续可以把一些editor中操作的属性单独的抽离出来， 没必要放在这里
    displayConfig: {
      label: lang.lang('表格'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-tree',
      disabled: false,
      // 是否禁用
      defaultValue: undefined,
      // 默认值
      multiple: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      clearable: false,
      // 是否显示清除按钮
      showSearch: false,
      // 是否显示搜索框，搜索选择的项的值，而不是文字
      treeCheckable: false,
      placeholder: lang.lang('请选择'),
      dynamicKey: '',
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      promptMessageContent: '',
      afterSaveResetStatus: false
    },
    default: {
      defaultValue: undefined,
      // 默认值,
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: ['TableInfoEditor'],
      elementConfig: ['LABEL_INFO',
      //label 标签
      'PLACEHOLDER', 'COMPONENT_WIDTH']
    }
  };

  var MeasurementConfig = {
    version: 'v2.0',
    code: 'MEASUREMENT',
    type: 'MEASUREMENT',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'MeasurementComponent',
      edit: 'MeasurementComponent',
      read: 'MeasurementComponent'
    },
    displayConfig: {
      label: lang.lang('商品计量'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%',
      // 宽度
      placeholder: '请输入',
      // 没有输入时，提示文字
      clearable: false,
      disabled: false,
      // 是否禁用，false不禁用，true禁用
      labelCol: {
        span: 4
      },
      isCustomLabelCol: false,
      afterSaveResetStatus: false,
      hidden: false,
      // 是否隐藏，false显示，true隐藏
      maxLength: null,
      promptMessageContent: '',
      isCc: false // 是否抄送字段
    },
    default: {
      defaultValue: '',
      value: '',
      model: '' // 数据字段
    },
    rules: [
    // 验证规则
    {
      required: false,
      // 必须填写
      message: lang.lang('必填项')
    }],
    editor: {
      tableConfig: [
        // 'TableInfoEditor'
      ],
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var GoodsAttrManagementConfig = {
    version: 'v2.0',
    code: 'GOODS_ATTR',
    type: 'GOODS_ATTR',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'GoodsAttrManagement',
      edit: 'GoodsAttrManagement',
      read: 'GoodsAttrManagement'
    },
    displayConfig: {
      label: lang.lang('商品属性'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var PutInStorageOrderGoodsConfig = {
    version: 'v2.0',
    code: 'PUT_IN_STORAGE_ORDER_GOODS',
    type: 'PUT_IN_STORAGE_ORDER_GOODS',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'PutInStorageOrderGoods',
      edit: 'PutInStorageOrderGoods',
      read: 'PutInStorageOrderGoods'
    },
    displayConfig: {
      label: lang.lang('入库订单表格'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var PutInStorageBillGoodsConfig = {
    version: 'v2.0',
    code: 'PUT_IN_STORAGE_BILL_GOODS',
    type: 'PUT_IN_STORAGE_BILL_GOODS',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'PutInStorageBillGoods',
      edit: 'PutInStorageBillGoods',
      read: 'PutInStorageBillGoods'
    },
    displayConfig: {
      label: lang.lang('入库单表格'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var PrepareGoodsDetailConfig = {
    version: 'v2.0',
    code: 'PREPARE_GOODS_DETAIL',
    type: 'PREPARE_GOODS_DETAIL',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'PrepareGoodsDetail',
      edit: 'PrepareGoodsDetail',
      read: 'PrepareGoodsDetail'
    },
    displayConfig: {
      label: lang.lang('拣货'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var ExpectedOutboundOperationGoodsConfig = {
    version: 'v2.0',
    code: 'EXPECTED-OUTBOUND-OPERATION-GOODS',
    type: 'EXPECTED-OUTBOUND-OPERATION-GOODS',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'ExpectedOutboundOperationGoods',
      edit: 'ExpectedOutboundOperationGoods',
      read: 'ExpectedOutboundOperationGoods'
    },
    displayConfig: {
      label: lang.lang('预出库详情表格'),
      labelHTML: '',
      // 标题增强
      icon: 'icon-write',
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var ReceiveGoodsDetailsConfig = {
    version: 'v2.0',
    code: 'RECEIVE_GOODS_DETAILS',
    type: 'RECEIVE_GOODS_DETAILS',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'ReceiveGoodsDetails',
      edit: 'ReceiveGoodsDetails',
      read: 'ReceiveGoodsDetails'
    },
    displayConfig: {
      label: lang.lang('收获详情'),
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var PutAwayListConfig = {
    version: 'v2.0',
    code: 'PUT_AWAY_LIST',
    type: 'PUT_AWAY_LIST',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'PutAwayList',
      edit: 'PutAwayList',
      read: 'PutAwayList'
    },
    displayConfig: {
      label: lang.lang('上架明细'),
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var ReviewBillGoodsDetailConfig = {
    version: 'v2.0',
    code: 'REVIEW_BILL_GOOD_DETAIL',
    type: 'REVIEW_BILL_GOOD_DETAIL',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'ReviewBillGoodsDetail',
      edit: 'ReviewBillGoodsDetail',
      read: 'ReviewBillGoodsDetail'
    },
    displayConfig: {
      label: lang.lang('复核组件'),
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var TakeStockAddConfig = {
    version: 'v2.0',
    code: 'TAKE_STOCK_ADD',
    type: 'TAKE_STOCK_ADD',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'TakeStockAdd',
      edit: 'TakeStockAdd',
      read: 'TakeStockAdd'
    },
    displayConfig: {
      label: lang.lang('盘点任务创建表格'),
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  var StartTakeStockConfig = {
    version: 'v2.0',
    code: 'START_TAKE_STOCK',
    type: 'START_TAKE_STOCK',
    // 表单类型
    key: '',
    renderComponent: {
      ide: 'StartTakeStock',
      edit: 'StartTakeStock',
      read: 'StartTakeStock'
    },
    displayConfig: {
      label: lang.lang('开始盘点表单'),
      width: '100%'
    },
    editor: {
      elementConfig: ['LABEL_INFO' // label 标签
      ]
    },
    methods: {}
  };

  // 仓储业务用到的配置 END
  var componentsConfig = {
    FormInputConfig,
    FormTextareaConfig,
    FormNumberInputConfig,
    FormSelectInputConfig,
    FormCheckBoxConfig,
    FormRadioBoxConfig,
    FormDateSelectConfig,
    FormSwitchInputConfig,
    FormButtonConfig,
    FormStaticTextConfig,
    FormPhoneInputConfig,
    FormCascadeSelectConfig,
    FormTreeSelectConfig,
    FormAreaSelectConfig,
    FormDividerBoxConfig,
    FormCardConfig,
    FormGridConfig,
    FormMyFieldConfig,
    FormUserSelectConfig,
    FormOrgSelectConfig,
    FormDocumentNumberConfig,
    // FormLogisticTrackConfig,
    FormAlertBoxConfig,
    FormTextFieldConfig,
    FormTableConfig,
    // 仓储业务用到的配置 START
    MeasurementConfig,
    GoodsAttrManagementConfig,
    PutInStorageOrderGoodsConfig,
    PutInStorageBillGoodsConfig,
    ExpectedOutboundOperationGoodsConfig,
    ReceiveGoodsDetailsConfig,
    PutAwayListConfig,
    PrepareGoodsDetailConfig,
    ReviewBillGoodsDetailConfig,
    TakeStockAddConfig,
    StartTakeStockConfig
    // 仓储业务用到的配置 END
  };

  var getV2ComponentConfigByType = type => {
    // 根据组件类型 获取 新组件componentConfig
    let v2ComponentConfig = Object.values(componentsConfig).find(item => item.type === type);
    if (v2ComponentConfig) {
      return v2ComponentConfig;
    }
    return {};
  };

  // 处理所有表单组件基础配置
  class FormComponentsControl {
    constructor(formSource) {
      this.formSource = formSource;
    }
    static registerComponentConfig(componentConfig) {
      if (componentConfig.code) {
        if (FormComponentsControl.componentMap.has(componentConfig.code)) {
          console.warn('组件类型已经存在，这里是替换之前存在的组件，若为期望效果，请忽略此警告', FormComponentsControl.componentMap.get(componentConfig.code));
        }
        FormComponentsControl.componentMap.set(componentConfig.code, componentConfig);
      }
    }
    static getComponentConfigByField(sqlFieldConfig) {
      if (!sqlFieldConfig) {
        console.warn('sqlFieldConfig 为空');
        return;
      }
      var componentCode = ylyFormConstants.FIELD_REFLECTION_COMPONENT[sqlFieldConfig.columnType];
      if (!componentCode) {
        console.warn('sqlFieldConfig映射为空', sqlFieldConfig);
        return convertComponentConfig(FormComponentsControl.componentMap.get('FORM_INPUT'));
      }
      var componentConfig = FormComponentsControl.componentMap.get(componentCode);
      return convertComponentConfig(componentConfig);
    }
    static getComponentConfigByCode(componentCode) {
      if (!componentCode) {
        console.warn('componentCode 为空');
        return;
      }
      var componentConfig = FormComponentsControl.componentMap.get(componentCode);
      return convertComponentConfig(componentConfig);
    }
    static registerGroupConfig(key, groupConfig) {
      if (FormComponentsControl.groupMap.has(key)) {
        console.warn('组件类型已经存在，这里是替换之前存在的组件，若为期望效果，请忽略此警告', FormComponentsControl.groupMap.get(key));
      }
      FormComponentsControl.groupMap.set(key, groupConfig);
    }
    static getGroupConfig(key) {
      if (!FormComponentsControl.groupMap.has(key)) {
        return [];
      }
      // 根据组
      var groupConfig = FormComponentsControl.groupMap.get(key).map(itemGroupConfig => {
        var cloneGroupConfig = cloneDeep(itemGroupConfig);
        cloneGroupConfig.groupCompList = cloneGroupConfig.groupCompList.map(compCode => {
          let componentConfig = null;
          if (compCode && typeof compCode === 'string') {
            componentConfig = FormComponentsControl.componentMap.get(compCode);
          }
          if (!componentConfig) {
            console.warn(`${compCode}`, ` 未找到指定的组件配置`);
          }
          return convertComponentConfig(componentConfig);
        }).filter(item => !!item);
        return cloneGroupConfig;
      });
      return groupConfig;
    }
    static registerEditorConfig(editorConfig) {
      if (FormComponentsControl.editorMap.has(editorConfig.code)) {
        console.warn('组件类型已经存在，这里是替换之前存在的组件，若为期望效果，请忽略此警告', FormComponentsControl.editorMap.get(editorConfig.code));
      }
      FormComponentsControl.editorMap.set(editorConfig.code, editorConfig);
    }
    // 根据表单组件的Code 获取editor 配置列表
    getEditorConfigByCompCode(compCode, filterEditorCode) {
      if (!FormComponentsControl.componentMap.has(compCode)) {
        console.warn(`${compCode}`, ` 未找到指定的组件配置`);
        return [];
      }
      let editorKey = 'editor';
      if (this.formSource.sourceContent.renderClient === 'mobile') {
        editorKey = 'mobileEditor';
      }
      var currentComponentEditor = FormComponentsControl.componentMap.get(compCode)[editorKey];
      var {
        tableConfig = [],
        elementConfig = []
      } = currentComponentEditor;
      // tableConfig 处理异常 TODO: 需要重新 梳理
      let editorConfig = {};
      editorConfig.tableConfig = tableConfig.map(editorCode => {
        return FormComponentsControl.editorMap.get(editorCode);
      }).filter(item => !!item);
      editorConfig.elementConfig = elementConfig.map(editorCode => {
        return FormComponentsControl.editorMap.get(editorCode);
      }).filter(item => !!item);
      return editorConfig;
    }
    static convertOldComponentConfig(componentConfig) {
      // 吧原先得组件转成新的
      // 吧 options 里面的参数转到 componentConfig、
      if (componentConfig.options && Object.prototype.toString.call(componentConfig.options) === '[object Object]') {
        Object.keys(componentConfig.options).forEach(key => {
          if (!componentConfig[key]) {
            componentConfig[key] = componentConfig.options[key];
          }
        });
      }
      var newComponentComponentConfig = getV2ComponentConfigByType(componentConfig.type);
      var loadFields = ['version', 'renderComponent', 'desc', 'editor', 'code'];
      loadFields.forEach(field => {
        if (!componentConfig[field]) {
          componentConfig[field] = newComponentComponentConfig[field];
        }
      });
      if (componentConfig.options && componentConfig.options.options) {
        componentConfig.options = componentConfig.options.options;
      } else if (componentConfig.code !== 'FORM_SELECT_INPUT' || !Array.isArray(componentConfig.options)) {
        delete componentConfig.options;
      }
    }
  }
  _defineProperty(FormComponentsControl, "componentMap", new Map());
  _defineProperty(FormComponentsControl, "groupMap", new Map());
  _defineProperty(FormComponentsControl, "editorMap", new Map());
  var convertComponentConfig = config => {
    var componentConfig = {
      ...config
    };
    if (componentConfig.version === 'v2.0') {
      // 新版的， 直接把 'displayConfig' 平铺到一层,
      // TODO : 这里可以把转换规则写死， 后续在做复杂逻辑转换处理
      Object.assign(componentConfig, componentConfig.displayConfig, componentConfig.default);
      delete componentConfig.displayConfig;
      delete componentConfig.default;
    }
    return componentConfig;
  };

  class FormDataControl {
    constructor(formSource) {
      _defineProperty(this, "ctlFormConfig", {
        formComponents: [],
        formRule: {}
      });
      _defineProperty(this, "ctlComponentMap", new Map());
      this.formFields = [];
      this.formSource = formSource;
      this.formData = {};
    }
    initFormConfig(formConfig) {
      if (formConfig) {
        this.setFormFields(formConfig.fields);
        this.updateFormItemList(formConfig.list);
      }
    }
    initFormData(formDta) {
      // TODO: 初始化表单基础数据
    }
    setFormFields(fields) {
      if (Array.isArray(fields)) {
        this.formFields = fields;
      }
    }
    getFormAllFields() {
      return this.formFields;
    }
    updateFormListConfig(formData) {
      // TODO: 后面可以构建规则引擎， 做统一管理表单更新配置
      if (formData.id) {
        this.getAllFormListConfig().forEach(item => {
          if (item.editStatusDisabled) {
            item.disabled = true;
          }
          if (item.editStatusHidden) {
            item.hidden = true;
          }
        });
      }
    }
    get formConfig() {
      return this.ctlFormConfig;
    }
    get formItemList() {
      // 可以根据不同的渲染段进行过滤不同组件
      return this.formConfig.formComponents;
    }
    updateFormItemList(formItemList) {
      if (Array.isArray(formItemList)) {
        this.ctlFormConfig.formComponents = formItemList;
      }
    }
    addItemInContainer(context) {
      var {
        formItemList,
        widget,
        index,
        replace
      } = context;
      var needReplaceIndex = replace ? 1 : 0;
      // 这里根据code 从配置里读更安全
      if (!widget.key) {
        widget.key = widget.code + new Date().getTime();
      }
      formItemList.splice(index, needReplaceIndex, widget);
      this.formSource.updateSelectedComponent(widget);
    }
    /**
     * 删除表单拖拽元素
     * @param {object} context 删除对象
     * @param {string} content.key 删除元素的key
     * @param {array} content.formItemList 删除元素的列表
     */
    deleteItemInContainer(context) {
      var {
        key,
        formItemList
      } = context;
      var index = formItemList.findIndex(item => item.key === key);
      if (index !== -1) {
        formItemList.splice(index, 1);
        let selectedComp;
        for (let i = index; i >= 0; i--) {
          if (formItemList[i]) {
            selectedComp = formItemList[i];
            break;
          }
        }
        this.formSource.updateSelectedComponent(selectedComp);
      }
    }
    getAllFormListConfig() {
      return utils.flattenComponents(this.formList);
    }
    getAllFormData() {
      if (this.formSource.renderClient === 'mobile') {
        return this.formData;
      } else if (this.formSource.formRef) {
        return this.formSource.formRef.getFieldsValue();
      }
      return {};
    }
    clearFormData() {
      /**
       * 目前只是一级数据结构
       */
      for (let key in this.formData) {
        delete this.formData[key];
      }
    }
    getFormComponentConfig(field) {
      if (!field) return null;
      var allFormListConfig = this.getAllFormListConfig();
      var formComponentConfig = allFormListConfig.find(item => {
        if (item.code === 'FORM_AREA_SELECT' && item.bindDataInfo) {
          var areaField = ['areaKey', 'cityKey', 'provinceKey'];
          areaField.forEach(itemField => {
            if (item.bindDataInfo[itemField] === field) {
              return item;
            }
          });
        }
        return item.model === field;
      });
      // 为组件添加隐藏方法
      formComponentConfig.hideComponent = function () {
        formComponentConfig.hidden = true;
      };
      formComponentConfig.showComponent = function () {
        formComponentConfig.hidden = false;
      };
      formComponentConfig.disableComponent = () => {
        formComponentConfig.disabled = true;
      };
      formComponentConfig.unDisabledComponent = () => formComponentConfig.disabled = false;
      return formComponentConfig;
    }
    getFormFieldValue(field) {
      if (!field) return null;
      return this.formSource.formRef.getFieldValue(field);
    }
    setFormFieldValue(values) {
      if (Object.prototype.toString.call(values) === '[object Object]') {
        // 判断是否是存在的model
        // var allModel = this.formFields.map(item => item.dbFieldName)
        // Object.keys(values).forEach(key => {
        //   if(!allModel.includes(key)) {
        //     delete values[key]
        //   }
        // })
        this.formSource.formRef.setFieldsValue(values);
      }
    }
  }

  var FormConfigTemplate = `
  var formConfig = {
    formPageConfig: <%- formPageConfig %>,
    formList: <%- formRenderConfig %>,
    formRequestOptions: {
      formCode: '<%=generateFormParams.formCode || generateFormParams.pageCode%>',
      saveUrl: '<%=generateFormParams.saveUrl%>',
      editUrl: '<%=generateFormParams.editUrl%>',
      queryUrl: '<%=generateFormParams.queryByIdUrl || generateFormParams.queryUrl%>'
    },
  }
  export default formConfig
`;

  var FormRenderTemplate = `
<template>
  <div class="form-code">
    <k-form-build
      ref="editFormComponent"
      :formCode="formRequestOptions.formCode"
      :value="formConfig"
    ></k-form-build>
    <div v-if="isMenuForm" style="text-align: right; margin-right: 16px;">
      <a-button type="primary" @click="saveFormPageData"> {{$t('保存')}} </a-button>
      <a-button @click="clearFormData"> {{$t('清空')}} </a-button>
    </div>
  </div>
</template>
<script>
import KFormBuild from "@/pages/design/module/kFormBuild/index.vue"
import componentsConfig from './components-config'
import cloneDeep from "lodash/cloneDeep"
import CommonEditFormMixin from '@/mixins/CommonEditFormMixin'
export default {
  name: '<%=generateFormParams.formCode%>',
  mixins: [CommonEditFormMixin],
	components: {
    KFormBuild,
  },
	props: {
    isMenuForm: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      componentsConfig: cloneDeep(componentsConfig),
      formRequestOptions: cloneDeep(componentsConfig.formRequestOptions),
      formList: cloneDeep(componentsConfig.formList)
    };
  },
	created() {
    this.initFormPageConfig(this.componentsConfig)
	},
	methods: {
  }
}
</script>
<style lang="scss">
.form-code {
  width: 100%;
}
</style>
`;

  var TableConfigTemplate = ` var TableComponentsConfig = {
  gridOptions: {
    autoResize: true,
    border: true,
    columnConfig: {
      resizable: false
    },
    customLeftButtons: <%- JSON.stringify(customLeftButtons) %>,
    optionsRowButtons: <%- JSON.stringify(optionsRowButtons) %>,
    columns: <%- JSON.stringify(gridOptionsColumns) %>,
    isSearch: <%= tableComponent.isSearch || 0 %>, //是否初始化查询 0 否 1 是
    isPage: <%= tableComponent.isPage || 0 %>, //是否分页 0 否 1 是
    pageConfig: {
      hiddenPageSize: false,
      hideOnSinglePage: false,
      showSizeChanger: true,
      pageSizeOptions: ['10', '20', '30', '40' ]
    },
    pagination: {
      pageNo: 1,
      pageSize: <%= tableComponent.pageSize || 10 %>,
      total: 0
    }
  },
  formQueryConfig: <%- JSON.stringify(formQueryConfig) %>,
  queryParams: {
    url: '',
    params: {}
  },
  sortType: '<%= sortType || ''%>',
  sortColumn: '<%= sortColumn || ''%>'
}
// columns 列配置说明
// 默认属性不生成， 可自行配置
// title:  展示table 和查询条件名称
// visible: true || false 是否展示
// field: '', table 和查询字段名key,
// sortable: true || false, 是否排序
// formatter: '' 展示形式
// align: 'left' || 'center' || 'right', 对其方式 左 中 呦
// minWidth: 100 最小宽度
// width: '' 宽度
// showOverflow: true || false , 超出宽度省略
export default TableComponentsConfig
`;

  var TableRenderTemplate = `

<template>
  <a-card class="query-card fragement-page" ref="pageCard">
    <test-query-panel
      :formQueryConfig="formQueryConfig"
      :queryParam="queryParam"
      :dictOptions="dictOptions"
      @searchByQuery="searchQuery(true)"
      @searchReset="searchReset"
    ></test-query-panel>
    <g-vxe-grid
      v-bind="gridOptions"
      :height="null"
      @size-change="pageSizeChange"
      @current-page-change="pageNoChange"
      @refreshData="searchQuery(true)"
      ref="xGrid"
    >
      <template v-if="gridOptions.customLeftButtons.length === 0" #toolBarBtn>
        <prefix-title style="margin-left: 8px;"/> 
      </template>
      <template #operation="{ row }">
        <table-options-col
          :optionsRowButtons="optionsRowButtons"
          :rowData="row"
          @rowButtonClick="rowButtonClick"
        ></table-options-col>
      </template>
    </g-vxe-grid>
    <form-edit-modal ref="FormEditModalRef" @updateTableList="searchQuery"/>
    <form-read-modal ref="FormReadModalRef"/>
  </a-card>
  </template>
  <script>
  import { VxeGridMixin } from "@/mixins/VxeGridMixin";
  import TableOptionsCol from '@/components/compose-table-component/table-options-col.vue';
  import FormEditModal from "@/components/compose-table-component/form-edit-modal.vue";
  import FormReadModal from "@/components/compose-table-component/form-read-modal.vue";
  import { queryPrintDefaultTemplate } from "@/api/print";
  import { jsonToPrintTemplate } from '@/pages/print/utils/print.util';
  import TestQueryPanel from "@/pages/design/onlineTest/online-component/test-query-panel.vue";
  import componentsConfig from './components-config'
  import { postAction, getAction } from '@/api/manage'
  import cloneDeep from "lodash/cloneDeep"
  export default {
  name: 'TableTest',
  mixins: [VxeGridMixin],
  components: {
    TableOptionsCol,
    TestQueryPanel,
    FormEditModal,
    FormReadModal
  },
  props: {
  },
  data() {
    return {
      tableRequestOptions: {
        queryUrl: "<%=generateFormParams.queryUrl%>",
        exportUrl: "<%=generateFormParams.exportUrl%>",
        deleteUrl: "<%=generateFormParams.deleteUrl%>",
      },
      componentId: '',
      toggleSearchStatus: false,
      queryParam: {},
      selectedRowKeys: [], // 选中行
      selectionRows: [], //选中列
      componentsConfig: cloneDeep(componentsConfig),
      gridOptions: {
        columns: [],
        columnConfig: {
          resizable : false
        },
        pageConfig: {
          hiddenPageSize: false,
          showSizeChanger: true, // 分页器
          pageSizeOptions: ["15", "30", "45"],
          hideOnSinglePage: false, // 如果数据单页  则隐藏分页功能
        },
        pagination: {
          pageNo: 1,
          pageSize: 15,
          total: 0,
        },
        customLeftButtons: []
      },
      optionsRowButtons: [],
      hasSearch: false,
      isQueryFields: [],
      dictOptions: {}
    };
  },
  computed: {
  },
  created() {
    this.initTableRenderConfig();
  },
  methods: {
    initTableRenderConfig() {
      if(this.componentsConfig) {
        var { gridOptions, formQueryConfig, componentId } = this.componentsConfig
        this.componentId = componentId
        Object.assign(this.gridOptions, gridOptions)
        this.gridOptions.columns.sort((a, b) => a.orderNum - b.orderNum)
        this.gridOptions.columns = this.getDefaultTableColsConfig(this.gridOptions.columns)
        this.initTableQueryControl(formQueryConfig)
        this.initTableButtonConfig(gridOptions)
        this.initPagination()
        if(this.gridOptions.isSearch === 1) {
          this.searchQuery()
        }
      }
    },
    initPagination() {
      if(!parseInt(this.gridOptions.isPage) == 1) {
        this.gridOptions.pagination.pageSize = 9999
        this.gridOptions.pageConfig.hideOnSinglePage = true
      }
    },
    initTableButtonConfig(gridOptions = {}) {
      var {customLeftButtons = [], optionsRowButtons = []} = gridOptions
      customLeftButtons
      .sort((a, b) => a.orderNum - b.orderNum)
      .forEach(item => {
        item.buttonEvent = () => this.tableToolbarClick(item)
      })

      this.optionsRowButtons = optionsRowButtons.sort((a, b) => a.orderNum - b.orderNum)
    },
    initTableQueryControl(formQueryConfig) {
      // 初始化查询条件
      if(Array.isArray(formQueryConfig)) {
        this.formQueryConfig = formQueryConfig
      }
    },
    searchQuery(isInit) {
      if (isInit) {
        Object.assign(this.gridOptions.pagination, componentsConfig.gridOptions.pagination)
      }
      var params = {
        ...this.queryParam,
        pageNo: this.gridOptions.pagination.pageNo,
        pageSize: this.gridOptions.pagination.pageSize,
        sortColumn: this.componentsConfig.sortColumn,
        sortType: this.componentsConfig.sortType
      }
      if(!params.sortColumn) delete params.sortColumn
      if(!params.sortType) delete params.sortType
      var searchUrl = this.tableRequestOptions.queryUrl + '/?pageNo=' + this.gridOptions.pagination.pageNo + '&pageSize=' + this.gridOptions.pagination.pageSize
      postAction(searchUrl, params, '/').then(res => {
        this.gridOptions.data = res.result.records;
        this.gridOptions.pagination.total = res.result.total;
      })
    },
    searchReset() {
      this.queryParam = {};
    },
    handleToggleSearch() {
      this.toggleSearchStatus = !this.toggleSearchStatus;
    },
    pageSizeChange(pageNo, pageSize) {
      this.gridOptions.pagination.pageNo = pageNo;
      this.gridOptions.pagination.pageSize = pageSize;
      this.searchQuery();
    },
    pageNoChange(pageNo) {
      console.log(pageNo);
      this.gridOptions.pagination.pageNo = pageNo;
      this.searchQuery();
    },
    tableToolbarClick(buttonConfig) {
      if(buttonConfig.dataOpType === 'custom') {
        let componentName = buttonConfig.buttonRefFunctionMethod
        if(componentName){
          let fnModules = componentName.split('.')
          this.$lib[fnModules[0]][fnModules[1]].call(this, {} , this.$refs.xGrid.getSelectedDta() , this)
        }
        return 
      }
      console.log(buttonConfig)
      if(buttonConfig.dataOpType === 'update') {
        this.$message.warning(this.$t('工具栏按钮无法编辑表单'))
      }
      if(buttonConfig.dataOpType === 'insert') {
        if(buttonConfig.openWay === 'new_page') {
          let pathParams = {
            formCode : buttonConfig.buttonRefFormCode
          }
          this.$router.push({
            path: '/form-page/form-new-tab/edit-form',
            query: {
              ...pathParams
            }
          })
        } else {
          try {
            var formConfig = require('@/pages/form-page/form-component/' + buttonConfig.buttonRefFormCode + '/components-config.js').default
            if(!formConfig || !Array.isArray(formConfig.formList)) {
              throw new Error('获取表单配置异常')
            }
            this.$refs.FormEditModalRef.openModal({
              formConfig, buttonConfig
            })
          } catch(err) {
            this.$message.warning(this.$t('加载表单配置异常') + ',' + this.$t('请确认表单类型是否正确') + '!')
            console.log(err)
          }
        }
      } else if(buttonConfig.dataOpType === 'print') {
        this.handleToPrint()
      } else if(buttonConfig.dataOpType === 'export') {
        this.handleExportTableComponentData()
      }
    },
    rowButtonClick(buttonConfig, rowData) {
      if(buttonConfig.dataOpType === 'custom') {
        let componentName = buttonConfig.buttonRefFunctionMethod
        if(componentName){
          let fnModules = componentName.split('.')
          this.$lib[fnModules[0]][fnModules[1]].call(this, {} , rowData , this.$refs.pageCard )
        }
        return 
      }
      if(buttonConfig.dataOpType === 'delete') {
        this.handleDeleteTableData(rowData)
      }
      let pathParams = {
        formCode : buttonConfig.buttonRefFormCode,
        rowId: rowData.id
      }
      if(['insert', 'update'].includes(buttonConfig.dataOpType)) {
        try {
          var formConfig = require('@/pages/form-page/form-component/' + buttonConfig.buttonRefFormCode + '/components-config.js').default
          if(!formConfig || !Array.isArray(formConfig.formList)) {
            throw new Error('获取表单配置异常')
          }
          this.$refs.FormEditModalRef.openModal({
            formConfig, buttonConfig, rowData
          })
        } catch(err) {
          this.$message.warning(this.$t('加载表单配置异常') + ',' + this.$t('请确认表单类型是否正确') + '!')
          console.log(err)
        }
      } else if(['detail'].includes(buttonConfig.dataOpType)) {
        if(buttonConfig.openWay === 'new_page') {
          this.$router.push({
            path: '/form-page/form-new-tab/show-form',
            query: {
              ...pathParams
            }
          })
        } else {
          try {
            var formConfig = require('@/pages/form-page/show-component/' + buttonConfig.buttonRefFormCode + '/components-config.js').default
            if(!formConfig || !Array.isArray(formConfig.formList)) {
              throw new Error('获取表单配置异常')
            }
            this.$refs.FormReadModalRef.openModal({
              formConfig, buttonConfig, rowData
            })
          } catch(err) {
            this.$message.warning(this.$t('加载表单配置异常') + ',' + this.$t('请确认表单类型是否正确') + '!')
            console.log(err)
          }
        }
      } else if(buttonConfig.dataOpType === 'print') {
        this.handleToPrint(rowData)
      } else if(buttonConfig.dataOpType === 'export') {
        this.handleExportTableComponentData()
      }
    },
    handleDeleteTableData(rowData) {
      this.$confirm({
        title: this.$t('确定') + '?',
        content: this.$t('是否删除'),
        okText: this.$t('确定'),
        cancelText: this.$t('取消'),
        onOk: () => {
          var urlParams = {
            id: rowData.id
          }
          var bodyParams = {}
          getAction(this.tableRequestOptions.deleteUrl, urlParams, '/').then(res => {
            if(res.code === 200) {
              this.$message.success(this.$t('删除成功'))
              this.searchQuery()
            }
          })
        }
      })
    },
    handleToPrint(rowData) {
      let allRowData = []
      if(!rowData) {
        allRowData = this.$refs.xGrid.getSelectedDta();
      } else {
        allRowData = [rowData]
      }
      if (allRowData.length === 0) return this.$message.warning(this.$t('请选中要打印的数据'))
      queryPrintDefaultTemplate({}, this.$route.query.projectCode).then(res => {
        if (res.result.templateText) {
          var printTemplate = jsonToPrintTemplate(res.result.templateText)
          if (!printTemplate) {
            return console.warn('解析打印模板失败')
          }
          if (window.hiwebSocket.opened) {
            // var printerList = printTemplate.getPrinterList()
            allRowData.forEach(rowData => {
              var printData = { ...rowData }
              var needShowTextFields = Object.keys(rowData).filter(field => field.substring(field.length - 7, field.length) === 'ShowTxt')
              if (needShowTextFields && needShowTextFields.length > 0) {
                needShowTextFields.forEach(field => {
                  if (field.substring(0, field.length - 7)) {
                    printData[field.substring(0, field.length - 7)] = rowData[field] || printData[field.substring(0, field.length - 7)]
                  }
                })
              }
              printTemplate.print2(printData, { paperNumberToggleInEven: true })
            })
            return
          }
          this.$message.error(this.$t('客户端未连接,无法直接打印'))
        }
      }).catch(err => {
        console.log(err)
      })
    },
    handleExportTableComponentData() {
      var { pageNo, pageSize } = this.gridOptions.pagination
      var params = {
        tableId: this.componentId,
        pageNo,
        pageSize,
        sortType: 'asc'
      }
      postAction(this.tableRequestOptions.exportUrl, params, '/').then(res => {
        console.log(res)
        this.$confirm({
          title: this.$t('导出成功'),
          content: this.$t('是否跳转到下载中心下载文件') + '?',
          okText: this.$t('确定'),
          cancelText: this.$t('取消'),
          onOk: () => {
            var pathParams = {
              projectId : this.$route.query.projectId,
              projectCode: this.$route.query.projectCode
            }
            this.$router.push({
            path: '/download-center',
              query: {
                ...pathParams
              }
            })
          }
        })
      })
    }
  },
  };
  </script>
  <style scoped>
  @import "~assets/less/common.less";
  .ant-calendar-picker {
  min-width: 0px !important;
  }
  </style>
  <style lang="scss">
  .fragement-page {
  height: 100%;
  padding: 12px;
  .query-table {
    flex: auto !important;
  }
  }
  </style>
`;

  var ShowRenderTemplate = `
<template>
  <div class="form-code">
    <k-form-build
      ref="formCode"
      :renderScene="'read'"
      :value="formConfig"
      :formCode="formRequestOptions.formCode"
    ></k-form-build>
  </div>
</template>
<script>
import KFormBuild from "@/pages/design/module/kFormBuild/index.vue"
import componentsConfig from './components-config'
import cloneDeep from "lodash/cloneDeep"
export default {
  name: '<%=generateFormParams.pageCode%>',
	components: {
    KFormBuild,
  },
	props: {
  },
  data() {
    return {
      formRequestOptions: cloneDeep(componentsConfig.formRequestOptions),
      formList: cloneDeep(componentsConfig.formList)
    };
  },
	created() {
    this.initFormConfig()
	},
	methods: {
    initFormConfig() {
      this.formConfig = {
        config: {},
        list: this.formList
      }
    }
  }
}
</script>
<style lang="scss">
.form-code {
  width: 100%;
}
</style>
`;

  var PageRenderTemplate = `
<template>
	<div class="compose-page">
		<a-card class="app-card" style="width: 100%; height: 100%;" ref="pageCard">
		<%_ componentListConfig.forEach(function(item){ _%>
			<div
				class="compose-page-menu <%= item.componentType === 'table' ? 'compose-table-menu' : 'compose-form-menu'%>"
				style="margin-top: 5px; border: 1px dashed #e5e5e5"
			>
				<div class="form-item-box">
					<%_ if(item.componentType === 'baseButton') { _%>
						<a-button type='<%=item.type%>' @click="event => elementOnClick(event , '<%=item.onClick.eventModule%>' , '<%=item.onClick.eventFunctionName%>')">
							{{ '<%=item.label%>' }}
						</a-button>
					<%_ } else if(item.componentType === 'baseButtonGroup') { _%>	
						<div style="text-align:<%=item.textAlign%>;">
						<%_ item.btnList.forEach(function(btn){ _%>
							<a-button type='<%=btn.type%>' @click="event => elementOnClick(event , '<%=btn.onClick.eventModule%>' , '<%=btn.onClick.eventFunctionName%>')">
								{{ '<%=btn.label%>' }}
							</a-button>
						<%_ }) _%>	
						</div>
					<%_ } else { _%>	
						<<%=item.componentCode%>
							ref="<%=item.componentCode%>"
							<%_ if(item.componentType === 'form') { _%>
							:isMenuForm="<%= !needCustomCodePageConfig.ShowPageSaveBtn %>"
							<%_ } _%>	
						/>
					<%_ } _%>	
				</div>
			</div>
		<%_ }) _%>	
		</a-card>
	</div>
</template>
<script>
<%_ componentListConfig.forEach(function(item){ _%>
<%_ if(item.componentType === 'baseButton' || item.componentType === 'baseButtonGroup') { _%>
<%_ } else { _%>	
import <%=item.componentCode%> from "@/pages/form-page/<%= item.componentTypePath %>/<%=item.componentCode%>/index.vue"
<%_ } _%>	
<%_ }) _%>	

import CloudPageBtnMixin from '@/mixins/CloudPageBtnMixin.js'
export default {
	name: '<%=needCustomCodePageConfig.pageCode%>Page',
	components: {
		<%_ componentListConfig.forEach(function(item){ _%>
			<%_ if(item.componentType !== 'baseButton' && item.componentType !== 'baseButtonGroup') { _%>
				<%= item.componentCode %> : <%= item.componentCode %>,
			<%_ } _%>
		<%_ }) _%>	
	},
	mixins: [ CloudPageBtnMixin ],
	data(){
		return {
		}
	},
	created() {},
	methods: {
	}	
}

</script>

`;

  var MobileFormRenderTemplate = `
<template>
	<div>
		<mobile-form-render
			class="mobile-preview"
			:value="formData"
			:formCode="formRequestOptions.formCode"
			:formRequestOptions="formRequestOptions"
		/>
	</div>
</template>

<script>
import MobileFormRender from "@/components/mobile-form-render";
import formConfig from './components-config'
import cloneDeep from "lodash/cloneDeep"
export default {
	name: '<%=generateFormParams.formCode%>',
	components: {
		MobileFormRender,
	},
	data() {
		return {
			formData: {
				list: [],
				config: formConfig.formPageConfig,
				fields: []
			},
			formRequestOptions: {}
		};
	},

	created() {
		this.formData.list = cloneDeep(formConfig.formList)
		this.formRequestOptions = cloneDeep(formConfig.formRequestOptions)
	},

	methods: {},
};
</script>
`;

  var MobilePageRenderTemplate = `
<template>
	<div class="compose-page">
		<%_ componentListConfig.forEach(function(item){ _%>
			<div class="form-item-box">
				<%_ if(item.componentType === 'baseButton') { _%>
					<a-button type='<%=item.type%>' @click="event => elementOnClick(event , '<%=item.onClick.eventModule%>' , '<%=item.onClick.eventFunctionName%>')">
						{{ '<%=item.label%>' }}
					</a-button>
				<%_ } else if(item.componentType === 'baseButtonGroup') { _%>	
					<div style="text-align:<%=item.textAlign%>;">
					<%_ item.btnList.forEach(function(btn){ _%>
						<a-button type='<%=btn.type%>' @click="event => elementOnClick(event , '<%=btn.onClick.eventModule%>' , '<%=btn.onClick.eventFunctionName%>')">
							{{ '<%=btn.label%>' }}
						</a-button>
					<%_ }) _%>	
					</div>
				<%_ } else { _%>	
					<<%=item.componentCode%>
						ref="<%=item.componentCode%>"
						<%_ if(item.componentType === 'form') { _%>
						:isMenuForm="<%= !needCustomCodePageConfig.ShowPageSaveBtn %>"
						<%_ } _%>	
					/>
				<%_ } _%>	
			</div>
		<%_ }) _%>	
	</div>
</template>
<script>
<%_ componentListConfig.forEach(function(item){ _%>
<%_ if(item.componentType === 'baseButton' || item.componentType === 'baseButtonGroup') { _%>
<%_ } else { _%>	
import <%=item.componentCode%> from "@/pages/form-page/<%= item.componentTypePath %>/<%=item.componentCode%>/index.vue"
<%_ } _%>	
<%_ }) _%>	
export default {
	name: '<%=needCustomCodePageConfig.pageCode%>Page',
	components: {
		<%_ componentListConfig.forEach(function(item){ _%>
			<%_ if(item.componentType !== 'baseButton' && item.componentType !== 'baseButtonGroup') { _%>
				<%= item.componentCode %> : <%= item.componentCode %>,
			<%_ } _%>
		<%_ }) _%>	
	},
	data(){
		return {
		}
	},
	created() {},
	methods: {
	}	
}

</script>

`;

  /**
   * 处理表单生成代码模板
   */
  var isNeedCustomCodePages = new Map([['shelfInfoPage', {
    saveUrl: '/coding/goodsPlace/generateGoodsPlace'
  }], ['goodsBillPage', {}], ['reviewBillDetailPage', {}], ['wmsputawaybill01', {}], ['receiveOperationPage', {}],
  // 收货操作
  ['wmsMoveStockPage', {}] // 移货
  ]);
  class PageTemplateController {
    constructor(formSource) {
      this.formSource = formSource;
    }
    /**
     * 生成表单组件/页面 代码
     * @param {*} generateComponentOrPageCode 
     * 
     */
    generateComponentOrPageCode(generateFormParams) {}
    // 不管什么表单 先成成所有表单组件配置 和表单渲染文件， 弹窗类型的可以取引用这个文件
    getFormRenderTemplateContent(generateFormParams) {
      try {
        var {
          renderClient
        } = this.formSource.sourceContent;
        return ejs.render(renderClient === 'mobile' ? MobileFormRenderTemplate : FormRenderTemplate, {
          generateFormParams
        });
      } catch (err) {
        console.error(err);
      }
    }
    getShowRenderTemplateContent(generateFormParams) {
      try {
        return ejs.render(ShowRenderTemplate, {
          generateFormParams
        });
      } catch (err) {
        console.error(err);
      }
    }
    getPageRenderTemplateContent(dragFragmentList, pageCode, mobileRenderClient) {
      var componentTypePathMap = {
        form: 'form-component',
        table: 'table-component',
        show: 'show-component'
        // baseButton: 'baseButton'
      };
      try {
        var componentListConfig = dragFragmentList.map(item => {
          if (item.componentType === 'baseButton') {
            if (item.onClick) {
              try {
                item.onClick = JSON.parse(item.onClick);
              } catch (error) {
                item.onClick = {};
              }
            } else {
              item.onClick = {};
            }
            return item;
          }
          if (item.componentType === 'baseButtonGroup') {
            item.btnList.forEach(btn => {
              debugger;
              if (btn.onClick) {
                try {
                  btn.onClick = JSON.parse(btn.onClick);
                } catch (error) {
                  btn.onClick = {};
                }
              } else {
                btn.onClick = {};
              }
            });
            return item;
          }
          return {
            componentId: item.componentId,
            componentName: item.componentName,
            componentCode: item.componentCode,
            componentType: item.componentType,
            componentTypePath: componentTypePathMap[item.componentType]
          };
        });
        var needCustomCodePageConfig = {
          pageCode
        };
        if (isNeedCustomCodePages.has(pageCode)) {
          // 需要自定义开发内容
          Object.assign(needCustomCodePageConfig, {
            ShowPageSaveBtn: true,
            StoragePageMixin: true,
            ...isNeedCustomCodePages.get(pageCode)
          });
        }
        return ejs.render(mobileRenderClient ? MobilePageRenderTemplate : PageRenderTemplate, {
          componentListConfig,
          needCustomCodePageConfig
        });
      } catch (err) {
        console.error(err);
      }
    }
    getPageConfigTemplateContent() {
      try {
        return ejs.render(PageRenderTemplate);
      } catch (err) {
        console.error(err);
      }
    }
    getFormRenderConfigContent(formData, generateFormParams) {
      //
      try {
        var columnNameUpperCaseMap = {};
        generateFormParams.fieldColumnList && generateFormParams.fieldColumnList.forEach(item => {
          columnNameUpperCaseMap[item.columnName] = item.fieldName;
        });
        var formRenderConfig = this.getFormRenderConfig(formData.list, columnNameUpperCaseMap);
        var {
          config = {}
        } = formData;
        var formPageConfig = {
          layout: config.layout || 'vertical',
          labelCol: config.labelCol || {
            span: 4
          },
          wrapperCol: config.wrapperCol || {
            span: 18
          },
          hideRequiredMark: config.hideRequiredMark || false
        };
        if (config.loadButtonRefFunctionMethod) formPageConfig.loadButtonRefFunctionMethod = config.loadButtonRefFunctionMethod;
        if (config.saveButtonRefFunctionMethod) formPageConfig.saveButtonRefFunctionMethod = config.saveButtonRefFunctionMethod;
        return ejs.render(FormConfigTemplate, {
          formRenderConfig: util.getJSON(formRenderConfig),
          formPageConfig: util.getJSON(formPageConfig),
          generateFormParams
        });
      } catch (err) {
        console.error(err);
      }
    }
    getFormRenderConfig(formDataList, columnNameUpperCaseMap) {
      return formDataList && formDataList.map(item => {
        var tempConfigField = ylyFormConstants.GetFormRenderConfigFieldByCode(item.code);
        var tempComponentConfig = {};
        tempConfigField.forEach(key => {
          tempComponentConfig[key] = item[key];
        });
        if (tempComponentConfig.code) {
          tempComponentConfig.code = item.code;
        }
        if (tempComponentConfig.code === 'FORM_CARD') {
          tempComponentConfig.list = this.getFormRenderConfig(item.list, columnNameUpperCaseMap);
        } else if (tempComponentConfig.code === 'FORM_GRID') {
          if (Array.isArray(tempComponentConfig.columns)) {
            tempComponentConfig.columns.forEach(col => {
              col.list = this.getFormRenderConfig(col.list, columnNameUpperCaseMap);
            });
          }
        }
        // 改变
        if (tempComponentConfig.code === 'FORM_AREA_SELECT') {
          ['areaKey', 'cityKey', 'provinceKey', 'provinceNameKey', 'cityNameKey', 'areaNameKey'].forEach(key => {
            tempComponentConfig.bindDataInfo[key] = columnNameUpperCaseMap[tempComponentConfig.bindDataInfo[key]];
          });
        } else if (tempComponentConfig.model && columnNameUpperCaseMap[tempComponentConfig.model]) {
          // 改变生成应用得model
          tempComponentConfig.model = columnNameUpperCaseMap[tempComponentConfig.model];
        }
        return tempComponentConfig;
      });
    }
    getTableRenderTemplateContent(generateFormParams, btnRefFormComponentList) {
      try {
        return ejs.render(TableRenderTemplate, {
          generateFormParams,
          btnRefFormComponentList
        });
      } catch (err) {
        console.error(err);
      }
    }
    getTableRenderConfigContent(tableComponentConfig, btnRefFormComponentList, generateFormParams) {
      //
      var {
        tableComponent,
        fieldList,
        buttonList
      } = tableComponentConfig;
      var alignStrMap = {
        0: 'left',
        1: 'center',
        2: 'right'
      };
      var columnNameUpperCaseMap = {};
      generateFormParams.fieldColumnList && generateFormParams.fieldColumnList.forEach(item => {
        columnNameUpperCaseMap[item.columnName] = item.fieldName;
      });
      var gridOptionsColumns = fieldList.filter(item => {
        if (columnNameUpperCaseMap[item.columnName]) {
          return true;
        }
        console.log(item.columnName, 'item ==>', '找不到映射');
        return false;
      }).sort((a, b) => a.orderNum - b.orderNum).map(item => {
        var itemConfig = {
          title: item.columnAliasText || item.columnText,
          // 展示table 和查询条件名称
          visible: item.isShow == 1,
          // 是否展示
          field: columnNameUpperCaseMap[item.columnName],
          // table 和查询字段名key
          sortable: item.sortFlag == 1,
          // 是否排序
          align: alignStrMap[item.alignType],
          // 对齐方式
          minWidth: item.columnWidth || 100,
          // 表格最小宽度
          isQueryField: item.isQuery == 1,
          // 是否查询条件
          showOverflow: item.isWidthOmit == 1,
          // 超出宽度省略
          width: item.columnWidth
        };
        if (item.convertFunctionCode) {
          itemConfig.convertFunctionCode = item.convertFunctionCode;
        }
        if (itemConfig.align === 'left') {
          delete itemConfig.align;
        }
        if (parseInt(itemConfig.width) === 100) {
          delete itemConfig.width;
        }
        util.filterEmptyProperties(itemConfig);
        return itemConfig;
      });
      if (tableComponent.isMultiChoice === 1) {
        gridOptionsColumns.unshift({
          type: "checkbox"
        });
      }
      if (tableComponent.isRowNum === 1) {
        gridOptionsColumns.unshift({
          type: "seq"
        });
      }
      gridOptionsColumns.push(VxeGridMixin.getOptionsDefaultConfig({
        type: "options",
        width: 120,
        fixed: parseInt(tableComponent.isFixOpColumn) === 1 && 'right',
        slots: {
          default: "operation"
        }
      }));
      var formQueryConfig = fieldList.filter(item => item.isQuery === 1 && item.queryShowType).map(item => {
        var itemConfig = {
          columnName: columnNameUpperCaseMap[item.columnName],
          columnText: item.queryAliasText || item.columnText,
          columnType: item.columnType,
          queryShowType: item.queryShowType,
          queryOperator: item.queryOperator,
          queryOrderNum: item.queryOrderNum || 0
        };
        if (item.queryShowType === 'select') {
          var selectFieldsName = ['queryDictType', 'queryDictText', 'queryDictTable', 'queryDictField', 'queryDictCondition', 'queryDictCode'];
          selectFieldsName.forEach(key => {
            itemConfig[key] = item[key];
          });
        }
        return itemConfig;
      });
      formQueryConfig.sort((a, b) => a.queryOrderNum - b.queryOrderNum);
      var customLeftButtons = buttonList && buttonList.filter(item => item.buttonType === 'toolbar').map(item => {
        var buttonRefForm = btnRefFormComponentList.find(formInfo => formInfo.componentId === item.buttonRefFormId);
        var itemConfig = {
          openWay: item.openWay,
          dataOpType: item.dataOpType,
          buttonLabel: item.buttonName,
          buttonRefFormCode: buttonRefForm && buttonRefForm.componentCode,
          orderNum: item.orderNum,
          icon: item.buttonIcon,
          buttonType: item.buttonStyle
        };
        if (item.buttonRefFunctionMethod) {
          itemConfig.buttonRefFunctionMethod = item.buttonRefFunctionMethod;
        }
        util.filterEmptyProperties(itemConfig);
        return itemConfig;
      });
      var optionsRowButtons = buttonList && buttonList.filter(item => item.buttonType === 'row').map(item => {
        var buttonRefForm = btnRefFormComponentList.find(formInfo => formInfo.componentId === item.buttonRefFormId);
        var itemConfig = {
          openWay: item.openWay,
          dataOpType: item.dataOpType,
          buttonName: item.buttonName,
          orderNum: item.orderNum,
          buttonRefFormCode: buttonRefForm && buttonRefForm.componentCode,
          icon: item.buttonIcon,
          buttonType: item.buttonStyle
        };
        if (item.buttonRefFunctionMethod) {
          itemConfig.buttonRefFunctionMethod = item.buttonRefFunctionMethod;
        }
        util.filterEmptyProperties(itemConfig);
        return itemConfig;
      });
      console.log(gridOptionsColumns);
      var sortColumnConfig = fieldList.find(item => item.defSortType) || {};
      var tableConfig = {
        gridOptionsColumns,
        tableComponent,
        formQueryConfig,
        customLeftButtons,
        optionsRowButtons,
        sortColumn: sortColumnConfig && (columnNameUpperCaseMap[sortColumnConfig.columnName] || sortColumnConfig.columnName),
        sortType: sortColumnConfig.defSortType
      };
      try {
        return ejs.render(TableConfigTemplate, {
          ...tableConfig
        });
      } catch (err) {
        console.error(err);
      }
    }
  }

  exports.FormComponentsControl = FormComponentsControl;
  exports.FormDataControl = FormDataControl;
  exports.PageTemplateController = PageTemplateController;

  Object.defineProperty(exports, '__esModule', { value: true });

})));
